From 0bf25ed4be2e2d311874bc34d263c020510f8490 Mon Sep 17 00:00:00 2001 From: Tim Deegan Date: Wed, 14 Mar 2007 12:49:40 +0000 Subject: [PATCH] [XEND] Mark save record fd close-on-exec after calling xc_restore so that qemu doesn't end up with an open fd on it Signed-off-by: Tim Deegan --- tools/python/xen/xend/XendCheckpoint.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py index 7881130092..be8c299634 100644 --- a/tools/python/xen/xend/XendCheckpoint.py +++ b/tools/python/xen/xend/XendCheckpoint.py @@ -9,6 +9,7 @@ import os import re import string import threading +import fcntl from struct import pack, unpack, calcsize from xen.util.xpopen import xPopen3 @@ -230,6 +231,15 @@ def restore(xd, fd, dominfo = None, paused = False): forkHelper(cmd, fd, handler.handler, True) + # We don't want to pass this fd to any other children -- we + # might need to recover ths disk space that backs it. + try: + flags = fcntl.fcntl(fd, fcntl.F_GETFD) + flags |= fcntl.FD_CLOEXEC + fcntl.fcntl(fd, fcntl.F_SETFD, flags) + except: + pass + if handler.store_mfn is None: raise XendError('Could not read store MFN') -- 2.30.2